|
[UBB] codes
Je roept de functie aan met ubbcode([text]) waar [text] de variabele is die je wil parsen. Hij zal dan smiles en html's tags parsen. Je zult de smiles zelf even moet maken, of ergens anders vandaan halen, want deze heb ik niet meer
<?php
function ubbcode($text){
$dir = "img";
$text = str_replace("<b>","[b]",$text);
$text = str_replace("</b>","[/b]",$text);
$text = str_replace("<i>","[i]",$text);
$text = str_replace("</i>","[/i]",$text);
$text = str_replace("<s>","[s]",$text);
$text = str_replace("</s>","[/s]",$text);
$text = str_replace("<u>","[u]",$text);
$text = str_replace("</u>","[/u]",$text);
$text = str_replace("<center>","[center]",$text);
$text = str_replace("</center>","[/center]",$text);
$text = str_replace("<blockquote><span class=\"mediumtxt\">quote:</span><hr size=\"1\">", "[quote]", $text);
$text = str_replace("<hr size=\"1\"></blockquote>", "[/quote]", $text);
$text = str_replace("<blockquote><span class=\"mediumtxt\">quote:</span><hr size=\"1\">", "[Quote]", $text);
$text = str_replace("<hr size=\"1\"></blockquote>", "[/Quote]", $text);
$text = str_replace("<blockquote><span class=\"mediumtxt\">code:</span><hr size=\"1\"><pre><font face=\"Courier New\">", "[code]", $text);
$text = str_replace("</font></pre><hr size=\"1\"></blockquote>", "[/code]", $text);
$text = str_replace("<i><font size=\"2\" color=\"#0066FF\">Offtopic:", "[ot]", $text);
$text = str_replace("</font></i>", "[/ot]", $text);
$text = preg_replace("/\[me=(.*?)\]/is", "<font size=\"2\" color=\"#FF0000\">* $session->user \\1</font>", $text);
$text = preg_replace("/\[img\](.+?)\[\/img\]/is",'<img src="S_SCRIPT">', $text);
$text = preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/is",'<a href="S_SCRIPT">\2</a>', $text);
$text = preg_replace("/\[url\](.*?)\[\/url\]/is", "<a href=\"\S_SCRIPT\">\S_SCRIPT</a>", $text);
$text = preg_replace("/\[mail\](.*?)\[\/mail\]/is", "<a href=\"mailto:\S_SCRIPT\">\S_SCRIPT</a>", $text);
$text = preg_replace("/\[mail=(.*?)\](.*?)\[\/mail\]/is", "<a href=\"mailto:\S_SCRIPT\">\\2</a>", $text);
$text = eregi_replace("<UL>","\[LIST\]",$text);
$text = eregi_replace("</UL>","\[/LIST\]",$text);
$text = eregi_replace("<LI>","\[\*\]",$text);
$text = eregi_replace("<font size=1>","\[SMALL\]",$text);
$text = eregi_replace("</font>","\[/SMALL\]",$text);
$text = eregi_replace("<hr>","\[hr\]",$text);
$text = str_replace("<img src=\"$dir/biggrin.gif\"> ", ":D", $text);
$text = str_replace("<img src=\"$dir/biggrin.gif\"> ", ":d", $text);
$text = str_replace("<img src=\"$dir/clown.gif\"> ", ":+", $text);
$text = str_replace("<img src=\"$dir/confused.gif\"> ", ":s", $text);
$text = str_replace("<img src=\"$dir/confused.gif\"> ", ":S", $text);
$text = str_replace("<img src=\"$dir/confused.gif\"> ", ":?", $text);
$text = str_replace("<img src=\"$dir/coool.gif\"> ", "8-)", $text);
$text = str_replace("<img src=\"$dir/devil.gif\"> ", "=:)", $text);
$text = str_replace("<img src=\"$dir/cry.gif\"> ", ":(", $text);
$text = str_replace("<img src=\"$dir/frown.gif\"> ", ":@", $text);
$text = str_replace("<img src=\"$dir/frusty.gif\"> ", "|:)", $text);
$text = str_replace("<img src=\"$dir/heart.gif\"> ", ":h", $text);
$text = str_replace("<img src=\"$dir/heart.gif\"> ", ":H", $text);
$text = str_replace("<img src=\"$dir/hypocrite.gif\"> ", "O-)", $text);
$text = str_replace("<img src=\"$dir/hypocrite.gif\"> ", "o-)", $text);
$text = str_replace("<img src=\"$dir/kwijl.gif\"> ", ":9~", $text);
$text = str_replace("<img src=\"$dir/loveit.gif\"> ", ":7", $text);
$text = str_replace("<img src=\"$dir/nosmile.gif\"> ", ":{", $text);
$text = str_replace("<img src=\"$dir/puh.gif\"> ", ":*", $text);
$text = str_replace("<img src=\"$dir/puh2.gif\"> ", ":p", $text);
$text = str_replace("<img src=\"$dir/puh2.gif\"> ", ":P", $text);
$text = str_replace("<img src=\"$dir/pukey.gif\"> ", ":r", $text);
$text = str_replace("<img src=\"$dir/pukey.gif\"> ", ":R", $text);
$text = str_replace("<img src=\"$dir/rc5.gif\"> ", "}:0", $text);
$text = str_replace("<img src=\"$dir/rc5.gif\"> ", "}:O", $text);
$text = str_replace("<img src=\"$dir/rc5.gif\"> ", "}:o", $text);
$text = str_replace("<img src=\"$dir/redface.gif\"> ", ":o", $text);
$text = str_replace("<img src=\"$dir/sadley.gif\"> ", ";(", $text);
$text = str_replace("<img src=\"$dir/shadey.gif\"> ", "B-)", $text);
$text = str_replace("<img src=\"$dir/shadey.gif\"> ", "b-)", $text);
$text = str_replace("<img src=\"$dir/shiny.gif\"> ", "*D", $text);
$text = str_replace("<img src=\"$dir/shiny.gif\"> ", "*d", $text);
$text = str_replace("<img src=\"$dir/shutup.gif\"> ", ":X", $text);
$text = str_replace("<img src=\"$dir/shutup.gif\"> ", ":x", $text);
$text = str_replace("<img src=\"$dir/sleepey.gif\"> ", ":Z", $text);
$text = str_replace("<img src=\"$dir/sleephappy.gif\"> ", ":z", $text);
$text = str_replace("<img src=\"$dir/vork.gif\"> ", ":Y)", $text);
$text = str_replace("<img src=\"$dir/vork.gif\"> ", ":y)", $text);
$text = str_replace("<img src=\"$dir/wink.gif\"> ", ";)", $text);
$text = str_replace("<img src=\"$dir/yawnee.gif\"> ", ":O", $text);
$text = str_replace("<img src=\"$dir/yummie.gif\"> ", ":9", $text);
$text = str_replace("<img src=\"$dir/smile.gif\"> ", ":)", $text);
$text = ereg_replace("<br>","\n",$text);
}
?>
download het script
Reacties van leden
Auteur: Rinse @ 23-08-2005
<tr><td width=100 valign="top">Info:</td>
<td><textarea name="info" cols=30 rows=10>{$data->info}</textarea></td></tr>
Kan ik daar ook ubb codes voor gebruiken bij criminals? Wil graag ubb codes kunnen activeren voor in mijn profiel kan je me ermee helpen? Auteur: Dago @ 08-10-2005
ja dat wil ik ook
|